"""
Author: Morphlng
Date: 2024-04-06 09:49:31
LastEditTime: 2024-12-16 23:09:09
LastEditors: Morphlng
Description: Define the interface for observation
FilePath: /DrivingGym/src/driving_gym/environment/agent/obs/base_obs.py
"""

from __future__ import annotations

import gymnasium as gym
import numpy as np

from driving_gym.data.data_provider import Snapshot
from driving_gym.environment.scenario.base_scenario import BaseScenario
from driving_gym.simulation.adapter_interface import AdapterInterface


class BaseObs:
    def __init__(self, config: dict, adapter: AdapterInterface = None):
        self.config = config.copy()
        self.adapter = adapter

        # This is automatically set by the environment
        self.actor_id: str = self.config["actor_id"]

    def reset(self):
        """Reset the observation handler."""
        pass

    def get_obs(self, snapshot: Snapshot, scenario: BaseScenario) -> np.ndarray:
        """Get the observation from the snapshot.

        Args:
            snapshot (Snapshot): The snapshot containing all data of the current frame.

        Returns:
            np.ndarray: Observation data.
        """
        raise NotImplementedError

    def get_observation_space(self) -> gym.Space:
        """Get the observation space."""
        raise NotImplementedError
